const express = require('express');
const filesRouter = require('./routes/file');
const fileUpload = require('express-fileupload');

const app = express();

// 使用内置中间件
app.use(express.urlencoded({ extended: false }));
app.use(express.json());
app.use(fileUpload());

// 注册路由
app.use('/files', filesRouter);

// 静态文件服务
app.use(express.static('resource'));

app.listen(3000, () => {
    console.log('Express app at: http://localhost:3000');
});